package com.qishenyuan.competition.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qishenyuan.competition.common.PageResult;
import com.qishenyuan.competition.common.PageUtil;
import com.qishenyuan.competition.common.Response;
import com.qishenyuan.competition.dto.ResumeReq;
import com.qishenyuan.competition.service.ResumeService;
import com.qishenyuan.competition.vo.ResumeResp;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Map;

/**
 * <p>
 * 简历表 前端控制器
 * </p>
 *
 * @author qishenyuan
 * @since 2025-04-05
 */
@RestController
@RequestMapping("/resume")
public class ResumeController {

    @Resource
    private ResumeService resumeService;

    @RequestMapping("/getResumeList")
    public Response<? extends Map> getResumeList(@RequestBody @Valid ResumeReq resumeReq){
        IPage<ResumeResp> resumeList = resumeService.getResumeList(resumeReq);
        PageResult<ResumeResp> pageResult = PageUtil.toPageResult(resumeList);
        return Response.ok(pageResult);
    }

    @GetMapping("/getResume/{id}")
    public Response<ResumeResp> getResume(@PathVariable Integer id){
        ResumeResp resume = resumeService.getResume(id);
        return Response.ok(resume);
    }

}
